package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.SystemDictionaryitem;
import cn.wolfcode.crm.mapper.SystemDictionaryitemMapper;
import cn.wolfcode.crm.qo.QueryObject;
import cn.wolfcode.crm.service.SystemDictionaryitemService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemDictionaryitemServiceImpl implements SystemDictionaryitemService {
    @Autowired
    private SystemDictionaryitemMapper systemDictionaryitemMapper;

    @Override
    public void insert(SystemDictionaryitem systemDictionaryitem) {
        systemDictionaryitemMapper.insert(systemDictionaryitem);
    }

    @Override
    public void deleteByPrimaryKey(Long id) {
        systemDictionaryitemMapper.deleteByPrimaryKey(id);
    }

    @Override
    public SystemDictionaryitem selectByPrimaryKey(Long id) {

        return systemDictionaryitemMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<SystemDictionaryitem> selectAll() {
        return systemDictionaryitemMapper.selectAll();
    }


    @Override
    public void updateByPrimaryKey(SystemDictionaryitem systemDictionaryitem) {
        systemDictionaryitemMapper.updateByPrimaryKey(systemDictionaryitem);
    }

    @Override
    public PageInfo<SystemDictionaryitem> query(QueryObject qo) {
       //查询字典目录数据
        PageHelper.startPage(qo.getCurrentPage(),qo.getPagSize());

        return new PageInfo<>(systemDictionaryitemMapper.queryForList(qo));
    }

}
